const { Schema, model } = require("mongoose");

const QuestionModel = new Schema({
  id: {
    type: String,
    required: true
  },
  type: {
    type: String,
    required: true,
    enum: ["radio", "checkbox"]
  },
  craeteDate: {
    type: Date,
    default: Date.now
  },
  updateDate: {
    type: Date,
    defaule: null
  },
  title: {
    type: String,
    required: true
  },
  answered: {
    type: Boolean,
    default: false
  },
  options: [
    {
      id: String,
      text: String,
      isRight: {
        type: Boolean,
        default: false
      }
    }
  ]
});

const Question = model("Question", QuestionModel);
module.exports = Question;
